Loading Data

imm_rpca <- readRDS(file.path(PATH, "data/sc/imm_rpca_subset.rds"))
boroni_sigs <- readRDS(file.path(PATH, "data/signatures/immune/boroni_2024/pan_cancer_myeloid_sigs.rds"))
boroni_sigs <- lapply(boroni_sigs, function(x) x[x %in% rownames(imm_rpca)])
boroni_sigs <- boroni_sigs[as.numeric(lapply(boroni_sigs, length)) > 0]

immune_celltypes <- readRDS(file.path(PATH, "data/signatures/immune/combined_celltypes.rds"))
immune_celltypes <- lapply(immune_celltypes, function(x) x[x %in% rownames(imm_rpca)])
immune_pathways <- readRDS(file.path(PATH, "data/signatures/immune/immune_pathways.rds"))
immune_pathways <- lapply(immune_pathways, function(x) x[x %in% rownames(imm_rpca)])

Annotations

All

imm_rpca$celltypist_imm_only <- with(imm_rpca@meta.data, 
                                     case_when(celltypist_broad == "Immune" ~ celltypist_pred,
                                               .default = celltypist_broad))
imm_rpca$singler_pred <- str_replace(imm_rpca$singler_pred, ", alpha-beta T cell", "")
imm_rpca$singler_pred <- str_replace(imm_rpca$singler_pred, ", alpha-beta memory T cell", " memory")
imm_rpca$singler_pred <- str_replace(imm_rpca$singler_pred, " positive memory", "positive memory")
imm_rpca$singler_pred <- str_replace(imm_rpca$singler_pred, "conventional dendritic cell", "cDC")
imm_rpca$singler_pred <- str_replace(imm_rpca$singler_pred, "plasmacytoid dendritic cell", "cDC")
imm_rpca$singler_pred <- str_replace(imm_rpca$singler_pred, "cell", "")
imm_rpca$singler_imm_only <- with(imm_rpca@meta.data, 
                                  case_when(singleR_broad == "Immune" ~ singler_pred,
                                            .default = singleR_broad))
imm_rpca$author_imm_only <- with(imm_rpca@meta.data, 
                                 case_when(author_broad == "Immune" ~ celltype_new,
                                           .default = author_broad))
Idents(imm_rpca) <- imm_rpca$RNA_snn_res.0.4

p1 <- DimPlot_scCustom(imm_rpca,
                       reduction = "umap.rpca",
                       group.by = "RNA_snn_res.0.4",
                       label = TRUE,
                       label.size = 3,
                       raster = FALSE,
                       repel = TRUE) + labs(title = "Clustering (0.4)", x = "UMAP 1", y = "UMAP 2")
p2 <- DimPlot_scCustom(seurat_object = imm_rpca,
                       group.by = "celltypist_imm_only",
                       reduction = "umap.rpca",
                       label = TRUE,
                       label.size = 1.5,
                       label.box = TRUE,
                       repel = TRUE,
                       raster = FALSE) + 
  labs(title = "Celltypist", x = "UMAP 1", y = "UMAP 2") +
  theme(legend.position = "none")
p3 <- DimPlot_scCustom(seurat_object = imm_rpca,
                       group.by = "singler_imm_only",
                       reduction = "umap.rpca",
                       label = TRUE,
                       label.size = 1.5, 
                       label.box = TRUE,
                       repel = TRUE,
                       raster = FALSE) + 
  labs(title = "SingleR", x = "UMAP 1", y = "UMAP 2") +
  theme(legend.position = "none")
p4 <- DimPlot_scCustom(imm_rpca,
                       reduction = "umap.rpca",
                       group.by = "author_imm_only",
                       label = TRUE,
                       label.size = 1.5,
                       label.box = TRUE,
                       repel = TRUE, 
                       raster = FALSE) + 
  labs(title = "Author", x = "UMAP 1", y = "UMAP 2") +
  theme(legend.position = "none")
combined <- cowplot::plot_grid(p1, p2, p3, p4, ncol = 2, nrow = 2)
ggsave(plot = combined, filename = file.path(PATH, "results/umaps/imm_rpca_annot_04.png"), height = 8, width = 9)
combined

NK

Cluster_Highlight_Plot(imm_rpca, reduction = "umap.rpca", cluster_name = c("23"))

FeaturePlot_scCustom(imm_rpca,
                     reduction = "umap.rpca",
                    features = "IFNG")
## 
## NOTE: FeaturePlot_scCustom uses a specified `na_cutoff` when plotting to
## color cells with no expression as background color separate from color scale.
## Please ensure `na_cutoff` value is appropriate for feature being plotted.
## Default setting is appropriate for use when plotting from 'RNA' assay.
## When `na_cutoff` not appropriate (e.g., module scores) set to NULL to
## plot all cells in gradient color palette.
## 
## -----This message will be shown once per session.-----

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = "CD14")

T + NK

t_nk <- c("CD3E", "CD4", "CD8A", "NKG7")
Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = t_nk)

names(boroni_sigs[27:37])
##  [1] "NK_cyto"    "NKT"        "TCD4_naive" "TCD8_naive" "TCD4_em"   
##  [6] "TCD8_em"    "TCD4_ex"    "TCD8_ex"    "TCD4_reg"   NA          
## [11] NA

NK_rest

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`NK_rest`)

NK_cyto

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`NK_cyto`)

NKT

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`NKT`)

CD4_naive

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`TCD4_naive`)

CD8_naive

cd8_naive <- unique(c(boroni_sigs$`TCD8_naive`, immune_pathways$CD8_naive))
Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = cd8_naive[1:4])

CD4_em

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`TCD4_em`)

CD8_em

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`TCD8_em`)

CD4_ex

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`TCD4_ex`)

CD8_ex

cd8_ex <- unique(c(boroni_sigs$TCD8_ex, immune_pathways$CD8_Tex))
Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = cd8_ex[1:10])

CD4_reg

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`TCD4_reg`)

CD4 Tfh

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = immune_pathways$CD4_Tfh[1:4])

CD8 Predysfunctional

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = immune_pathways$CD8_predysfunc[1:4])

CD8 Dysfunctional

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = immune_pathways$CD8_dysfunctional[1:4])

CD8 Cytotoxic

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = immune_pathways$CD8_cytotoxic[1:4])

CD8 TRM

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = immune_pathways$CD8_TRM[1:4])

CD8/CD4 T sr

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = immune_pathways$CD4_CD8_Tstr[1:4])

Myeloid

phagocytes <- c("LYZ", "AIF1", "CD68")
Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = phagocytes)

names(boroni_sigs)[str_detect(names(boroni_sigs), pattern = "Mono|Mac|RTM|cDC|Neutrophil")]
##  [1] "Mac_Alv_like"      "Mac_Angio"         "Mac_Hypo"         
##  [4] "Mac_ES"            "Mac_IFN"           "Mac_LA"           
##  [7] "Mac_AgPres"        "RTM_IFN"           "RTM_like_MT"      
## [10] "Neutrophil_TAGLN2" "Neutrophil_MMP9"   "cDC1_CLEC9A"      
## [13] "cDC2_AREG"         "cDC2_FCER1A"       "cDC3_CD14"        
## [16] "cDC4_FCGR3A"       "cDC_CXCL8"         "cDC2_CD207"       
## [19] "cDC_LAMP3"         "Mono_FCGR3A"       "Mono_CD14_FOS-"   
## [22] "Mono_CD14_FOS+"    "Mono_IL1B"         "MonoInter_CXCL10" 
## [25] "MonoInter_CLEC10A"

Monocytes

Mono_FCGR3A

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mono_FCGR3A`)

Mono_CD14_FOS-

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mono_CD14_FOS-`)

Mono_CD14_FOS+

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mono_CD14_FOS+`)

Mono_IL1B

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mono_IL1B`)

MonoInter_CXCL10

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`MonoInter_CXCL10`)

MonoInter_CLEC10A

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`MonoInter_CLEC10A`)

Macrophages

Mac_Alv_like

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mac_Alv_like`)

Mac_Angio

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mac_Angio`)

Mac_Hypo

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mac_Hypo`)

Mac_ES

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mac_ES`)

Mac_IFN

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mac_IFN`)

Mac_LA

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mac_LA`)

Mac_AgPres

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`Mac_AgPres`)

RTM_IFN

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`RTM_IFN`)

RTM_like_MT

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`RTM_like_MT`)

Mast Cells

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = c("TPSAB1", "CMA1"))

Neutrophils

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = c(boroni_sigs$`Neutrophil_TAGLN2`, boroni_sigs$`Neutrophil_MMP9`))

B cells

b_cells <- c("MS4A1", "MZB1")
Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = b_cells)

Dendritic

dendritic <- c("LILRA4", "IRF7")
Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = dendritic)

cDC1_CLEC9A

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`cDC1_CLEC9A`)

cDC2_AREG

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`cDC2_AREG`)

cDC2_FCER1A

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`cDC2_FCER1A`)

cDC3_CD14

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`cDC3_CD14`)

cDC4_FCGR3A

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`cDC4_FCGR3A`)

cDC_CXCL8

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`cDC_CXCL8`)

cDC2_CD207

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`cDC2_CD207`)

cDC_LAMP3

Plot_Density_Custom(imm_rpca,
                    reduction = "umap.rpca",
                    features = boroni_sigs$`cDC_LAMP3`)